﻿using Abp.Application.Services;
using Abp.AspNetCore.Mvc.Authorization;
using AbpZeroTemplate.Authorization;
using AbpZeroTemplate.Configuration.Host;
using AbpZeroTemplate.Configuration.Host.Dto;
using AbpZeroTemplate.Web.Controllers;
using AbpZeroTemplate.Web.Swagger;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace AbpZeroTemplate.Api.Admin.Controllers
{
    /// <summary>Host配置信息
    /// </summary>
    [Area("Admin")]
    [Route("Admin/HostSettings/[action]")]
    [ApiName("Admin")]
    [RemoteService]
    [AbpMvcAuthorize(AppPermissions.Pages_Administration_Host_Settings)]
    public class HostSettingsController : AbpZeroTemplateControllerBase
    {
        private readonly IHostSettingsAppService _hostSettingsAppService;
        /// <summary>ctor
        /// </summary>
        public HostSettingsController(IHostSettingsAppService hostSettingsAppService)
        {
            _hostSettingsAppService = hostSettingsAppService;
        }

        /// <summary>获取全部配置
        /// </summary>
        [HttpGet]
        public async Task<HostSettingsEditDto> GetAllSettings()
        {
            return await _hostSettingsAppService.GetAllSettings();
        }

        /// <summary>修改全部配置
        /// </summary>
        [HttpPost]
        public async Task UpdateAllSettings([FromBody]HostSettingsEditDto input)
        {
            await _hostSettingsAppService.UpdateAllSettings(input);
        }


    }
}
